﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// Base class for all list controls which allow selecting a single item only.
	/// </summary>
	public abstract class BaseSingleValueListControl : BaseListControl, ISingleValueListControl
	{
		/// <summary>
		/// Gets or sets the selected item.
		/// </summary>
		/// <remarks>
		/// This will only work if the Items collection is populated. One way to ensure this is to include "Items" in the control reference's properties list.
		/// </remarks>
		[Browsable(false)]
		public ListItem SelectedItem
		{
			get
			{
				return SingleValueListControlCommon.get_SelectedItem(this);
			}
			set
			{
				SingleValueListControlCommon.set_SelectedItem(this, value);
			}
		}
		/// <summary>
		/// When implemented, gets or sets the index of the selected item.
		/// </summary>
		[Category("Data")]
		public int SelectedIndex
		{
			get
			{
				return SingleValueListControlCommon.get_SelectedIndex(this);
			}
			set
			{
				SingleValueListControlCommon.set_SelectedIndex(this, value);
			}
		}
	}
}
